CE.ClassList = {}
-- SwapClassFrame <OnLoad>
function CE.SwapClass_OnLoad(this)
	this:RegisterEvent("EXCHANGECLASS_SHOW")
end
-- SwapClassFrame <OnEvent>
function CE.SwapClass_OnEvent(this, event)
	if event == "EXCHANGECLASS_SHOW" then
		CE.GetClasses()
		if CE_Settings[CE.playerName]["Tab1"]["SwapClass"] then
			ExchangeClassFrame:SetAlpha(0)
			SwapClassFrame:SetAlpha(1)
		else
			ExchangeClassFrame:SetAlpha(1)
			SwapClassFrame:SetAlpha(0)
		end
	end
end
-- Get Classes
function CE.GetClasses()
	CE.ClassList = {}
	local numClasses = GetNumClasses();
	local class, token, level, currExp, maxExp
	for i = 1, numClasses do
		class, token, level, currExp, maxExp = GetPlayerClassInfo(i)
		if class ~= nil then
			table.insert(CE.ClassList, token)
		end
	end
	table.insert(CE.ClassList, 0)
end
-- Set new class
function CE.NewClass()
	local newMainClass, newSubClass;
	local mainClass, subClass = UnitClass("player");
	
	if ( ExchangeClassInfo[EXCHANGECLASS_MAINCLASS] ) then
		newMainClass = ExchangeClassInfo[EXCHANGECLASS_MAINCLASS].class;
	else
		newMainClass = "";
	end
	
	if ( ExchangeClassInfo[EXCHANGECLASS_SUBCLASS] ) then
		newSubClass = ExchangeClassInfo[EXCHANGECLASS_SUBCLASS].class;
	else
		newSubClass = "";
	end
	
	if ( mainClass ~= newMainClass or subClass ~= newSubClass ) then
		if ( newSubClass == "" ) then
			newSubClass = TEXT("C_TITLE_NIL");
		end
		StaticPopup_Show("EXCHANGE_CLASS", newMainClass, newSubClass);
	else
		HideUIPanel(ExchangeClassFrame);
	end
end
-- Set New Class Text
function CE.NewClassText()
	if SwapClassFrame:IsVisible() then
		SwapClassFrame_NewClass_Main:SetText(TEXT("CLASS_CHANGE_CLASS1")..":   |cff00FF00"..ExchangeClassInfo[EXCHANGECLASS_MAINCLASS].class)
		SwapClassFrame_NewClass_Sec:SetText(TEXT("CLASS_CHANGE_CLASS2")..":   |cff00FFFF"..ExchangeClassInfo[EXCHANGECLASS_SUBCLASS].class)
	end
end
-- Clear button selection
function CE.SwapClassClearText(arg)
	if arg ~= 1 then
		UIDropDownMenu_SetSelectedValue(SwapClassFrame_Dropdown1, "")
	end
	if arg ~= 2 then
		UIDropDownMenu_SetSelectedValue(SwapClassFrame_Dropdown2, "")
	end
	if arg ~= 3 then
		UIDropDownMenu_SetSelectedValue(SwapClassFrame_Dropdown3, "")
	end
	if arg ~= 4 then
		UIDropDownMenu_SetSelectedValue(SwapClassFrame_Dropdown4, "")
	end
	if arg ~= 5 then
		UIDropDownMenu_SetSelectedValue(SwapClassFrame_Dropdown5, "")
	end
	if arg ~= 6 then
		UIDropDownMenu_SetSelectedValue(SwapClassFrame_Dropdown6, "")
	end
	if arg ~= 7 then
		UIDropDownMenu_SetSelectedValue(SwapClassFrame_Dropdown7, "")
	end
	if arg ~= 8 then
		UIDropDownMenu_SetSelectedValue(SwapClassFrame_Dropdown8, "")
	end
	if arg ~= 9 then
		UIDropDownMenu_SetSelectedValue(SwapClassFrame_Dropdown9, "")
	end
	if arg ~= 10 then
		UIDropDownMenu_SetSelectedValue(SwapClassFrame_Dropdown10, "")
	end
end	
-- Set Text to buttons
function CE.SetExp()
	local numClasses = GetNumClasses();
	local class, token, level, currExp, maxExp
	-- diasble buttons and clear text
	SwapClassFrame_Dropdown1Button:Disable()
	SwapClassFrame_Dropdown1_Text:SetText("")
	SwapClassFrame_Dropdown2Button:Disable()
	SwapClassFrame_Dropdown2_Text:SetText("")
	SwapClassFrame_Dropdown3Button:Disable()
	SwapClassFrame_Dropdown3_Text:SetText("")
	SwapClassFrame_Dropdown4Button:Disable()
	SwapClassFrame_Dropdown4_Text:SetText("")
	SwapClassFrame_Dropdown5Button:Disable()
	SwapClassFrame_Dropdown5_Text:SetText("")
	SwapClassFrame_Dropdown6Button:Disable()
	SwapClassFrame_Dropdown6_Text:SetText("")
	SwapClassFrame_Dropdown7Button:Disable()
	SwapClassFrame_Dropdown7_Text:SetText("")
	SwapClassFrame_Dropdown8Button:Disable()
	SwapClassFrame_Dropdown8_Text:SetText("")
	SwapClassFrame_Dropdown9Button:Disable()
	SwapClassFrame_Dropdown9_Text:SetText("")
	SwapClassFrame_Dropdown10Button:Disable()
	SwapClassFrame_Dropdown10_Text:SetText("")
	-- if class available, enable buttons
	for i = 1, numClasses do
		class, token, level, currExp, maxExp = GetPlayerClassInfo(i)
		if token ~= nil then
			local expirience = round(currExp*100/maxExp, 2)
			if token == "KNIGHT" then
				SwapClassFrame_Dropdown1_Text:SetText(TEXT("SYS_CLASSNAME_KNIGHT").." lv:"..level.." exp:"..expirience.."%")
				SwapClassFrame_Dropdown1Button:Enable()
			elseif token == "WARRIOR" then
				SwapClassFrame_Dropdown2_Text:SetText(TEXT("SYS_CLASSNAME_WARRIOR").." lv:"..level.." exp:"..expirience.."%")
				SwapClassFrame_Dropdown2Button:Enable()
			elseif token == "RANGER" then
				SwapClassFrame_Dropdown3_Text:SetText(TEXT("SYS_CLASSNAME_RANGER").." lv:"..level.." exp:"..expirience.."%")
				SwapClassFrame_Dropdown3Button:Enable()
			elseif token == "THIEF" then
				SwapClassFrame_Dropdown4_Text:SetText(TEXT("SYS_CLASSNAME_THIEF").." lv:"..level.." exp:"..expirience.."%")
				SwapClassFrame_Dropdown4Button:Enable()
			elseif token == "MAGE" then
				SwapClassFrame_Dropdown5_Text:SetText(TEXT("SYS_CLASSNAME_MAGE").." lv:"..level.." exp:"..expirience.."%")
				SwapClassFrame_Dropdown5Button:Enable()
			elseif token == "AUGUR" then
				SwapClassFrame_Dropdown6_Text:SetText(TEXT("SYS_CLASSNAME_AUGUR").." lv:"..level.." exp:"..expirience.."%")
				SwapClassFrame_Dropdown6Button:Enable()
			elseif token == "WARDEN" then
				SwapClassFrame_Dropdown7_Text:SetText(TEXT("SYS_CLASSNAME_WARDEN").." lv:"..level.." exp:"..expirience.."%")
				SwapClassFrame_Dropdown7Button:Enable()
			elseif token == "DRUID" then
				SwapClassFrame_Dropdown8_Text:SetText(TEXT("SYS_CLASSNAME_DRUID").." lv:"..level.." exp:"..expirience.."%")
				SwapClassFrame_Dropdown8Button:Enable()
			elseif token == "HARPSYN" then
				SwapClassFrame_Dropdown9_Text:SetText(TEXT("SYS_CLASSNAME_HARPSYN").." lv:"..level.." exp:"..expirience.."%")
				SwapClassFrame_Dropdown9Button:Enable()
			elseif token == "PSYRON" then
				SwapClassFrame_Dropdown10_Text:SetText(TEXT("SYS_CLASSNAME_PSYRON").." lv:"..level.." exp:"..expirience.."%")
				SwapClassFrame_Dropdown10Button:Enable()
			end
		end
	end
end
-------------------------------------
--== Swap Class Dropdown Buttons ==--
-------------------------------------
function SwapClassDropDown_OnLoad(this, token)
	if token == "KNIGHT" then
		UIDropDownMenu_Initialize(this, SwapClassFrame_Dropdown1_Show);
		UIDropDownMenu_SetWidth(this, 150 );
	elseif token == "WARRIOR" then
		UIDropDownMenu_Initialize(this, SwapClassFrame_Dropdown2_Show);
		UIDropDownMenu_SetWidth(this, 150 );
	elseif token == "RANGER" then
		UIDropDownMenu_Initialize(this, SwapClassFrame_Dropdown3_Show);
		UIDropDownMenu_SetWidth(this, 150 );
	elseif token == "THIEF" then
		UIDropDownMenu_Initialize(this, SwapClassFrame_Dropdown4_Show);
		UIDropDownMenu_SetWidth(this, 150 );
	elseif token == "MAGE" then
		UIDropDownMenu_Initialize(this, SwapClassFrame_Dropdown5_Show);
		UIDropDownMenu_SetWidth(this, 150 );
	elseif token == "AUGUR" then
		UIDropDownMenu_Initialize(this, SwapClassFrame_Dropdown6_Show);
		UIDropDownMenu_SetWidth(this, 150 );
	elseif token == "WARDEN" then
		UIDropDownMenu_Initialize(this, SwapClassFrame_Dropdown7_Show);
		UIDropDownMenu_SetWidth(this, 150 );
	elseif token == "DRUID" then
		UIDropDownMenu_Initialize(this, SwapClassFrame_Dropdown8_Show);
		UIDropDownMenu_SetWidth(this, 150 );
	elseif token == "HARPSYN" then
		UIDropDownMenu_Initialize(this, SwapClassFrame_Dropdown9_Show);
		UIDropDownMenu_SetWidth(this, 150 );
	elseif token == "PSYRON" then
		UIDropDownMenu_Initialize(this, SwapClassFrame_Dropdown10_Show);
		UIDropDownMenu_SetWidth(this, 150 );
	end
end
-- Warrior 2
function SwapClassFrame_Dropdown2_Show()
	CE.SwapClassClearText(2)
	for k,v in pairs(CE.ClassList) do
		if v ~= "WARRIOR" then
			buttonInfo = {}
			if v == 0 then
				buttonInfo.text = TEXT("C_TITLE_NIL")
			else
				buttonInfo.text = TEXT("SYS_CLASSNAME_WARRIOR").."/"..TEXT("SYS_CLASSNAME_"..v)
			end
			buttonInfo.value = v
			buttonInfo.func = SwapClassFrame_Dropdown2_Click
			UIDropDownMenu_AddButton(buttonInfo, 1)
		end
	end
end
function SwapClassFrame_Dropdown2_Click(button)
	UIDropDownMenu_SetSelectedValue(SwapClassFrame_Dropdown2, button.value)
	EXCHANGECLASS_MAINCLASS = 2
	if button.value == 0 then
		EXCHANGECLASS_SUBCLASS = 0
	elseif button.value == "WARRIOR" then
		EXCHANGECLASS_SUBCLASS = 2
	elseif button.value == "RANGER" then
		EXCHANGECLASS_SUBCLASS = 3
	elseif button.value == "THIEF" then
		EXCHANGECLASS_SUBCLASS = 4
	elseif button.value == "MAGE" then
		EXCHANGECLASS_SUBCLASS = 5	
	elseif button.value == "AUGUR" then
		EXCHANGECLASS_SUBCLASS = 6
	elseif button.value == "KNIGHT" then
		EXCHANGECLASS_SUBCLASS = 7
	elseif button.value == "WARDEN" then
		EXCHANGECLASS_SUBCLASS = 8
	elseif button.value == "DRUID" then
		EXCHANGECLASS_SUBCLASS = 9
	elseif button.value == "HARPSYN" then
		EXCHANGECLASS_SUBCLASS = 10
	elseif button.value == "PSYRON" then
		EXCHANGECLASS_SUBCLASS = 11
	end
end
-- Scout 3
function SwapClassFrame_Dropdown3_Show()
	CE.SwapClassClearText(3)
	for k,v in pairs(CE.ClassList) do
		if v ~= "RANGER" then
			buttonInfo = {}
			if v == 0 then
				buttonInfo.text = TEXT("C_TITLE_NIL")
			else
				buttonInfo.text = TEXT("SYS_CLASSNAME_RANGER").."/"..TEXT("SYS_CLASSNAME_"..v)
			end
			buttonInfo.value = v
			buttonInfo.func = SwapClassFrame_Dropdown3_Click
			UIDropDownMenu_AddButton(buttonInfo, 1)
		end
	end
end
function SwapClassFrame_Dropdown3_Click(button)
	UIDropDownMenu_SetSelectedValue(SwapClassFrame_Dropdown3, button.value)
	EXCHANGECLASS_MAINCLASS = 3
	if button.value == 0 then
		EXCHANGECLASS_SUBCLASS = 0
	elseif button.value == "WARRIOR" then
		EXCHANGECLASS_SUBCLASS = 2
	elseif button.value == "RANGER" then
		EXCHANGECLASS_SUBCLASS = 3
	elseif button.value == "THIEF" then
		EXCHANGECLASS_SUBCLASS = 4
	elseif button.value == "MAGE" then
		EXCHANGECLASS_SUBCLASS = 5	
	elseif button.value == "AUGUR" then
		EXCHANGECLASS_SUBCLASS = 6
	elseif button.value == "KNIGHT" then
		EXCHANGECLASS_SUBCLASS = 7
	elseif button.value == "WARDEN" then
		EXCHANGECLASS_SUBCLASS = 8
	elseif button.value == "DRUID" then
		EXCHANGECLASS_SUBCLASS = 9
	elseif button.value == "HARPSYN" then
		EXCHANGECLASS_SUBCLASS = 10
	elseif button.value == "PSYRON" then
		EXCHANGECLASS_SUBCLASS = 11
	end
end
-- Rogue 4
function SwapClassFrame_Dropdown4_Show()
	CE.SwapClassClearText(4)
	for k,v in pairs(CE.ClassList) do
		if v ~= "THIEF" then
			buttonInfo = {}
			if v == 0 then
				buttonInfo.text = TEXT("C_TITLE_NIL")
			else
				buttonInfo.text = TEXT("SYS_CLASSNAME_THIEF").."/"..TEXT("SYS_CLASSNAME_"..v)
			end
			buttonInfo.value = v
			buttonInfo.func = SwapClassFrame_Dropdown4_Click
			UIDropDownMenu_AddButton(buttonInfo, 1)
		end
	end
end
function SwapClassFrame_Dropdown4_Click(button)
	UIDropDownMenu_SetSelectedValue(SwapClassFrame_Dropdown4, button.value)
	EXCHANGECLASS_MAINCLASS = 4
	if button.value == 0 then
		EXCHANGECLASS_SUBCLASS = 0
	elseif button.value == "WARRIOR" then
		EXCHANGECLASS_SUBCLASS = 2
	elseif button.value == "RANGER" then
		EXCHANGECLASS_SUBCLASS = 3
	elseif button.value == "THIEF" then
		EXCHANGECLASS_SUBCLASS = 4
	elseif button.value == "MAGE" then
		EXCHANGECLASS_SUBCLASS = 5	
	elseif button.value == "AUGUR" then
		EXCHANGECLASS_SUBCLASS = 6
	elseif button.value == "KNIGHT" then
		EXCHANGECLASS_SUBCLASS = 7
	elseif button.value == "WARDEN" then
		EXCHANGECLASS_SUBCLASS = 8
	elseif button.value == "DRUID" then
		EXCHANGECLASS_SUBCLASS = 9
	elseif button.value == "HARPSYN" then
		EXCHANGECLASS_SUBCLASS = 10
	elseif button.value == "PSYRON" then
		EXCHANGECLASS_SUBCLASS = 11
	end
end
-- Mage 5
function SwapClassFrame_Dropdown5_Show()
	CE.SwapClassClearText(5)
	for k,v in pairs(CE.ClassList) do
		if v ~= "MAGE" then
			buttonInfo = {}
			if v == 0 then
				buttonInfo.text = TEXT("C_TITLE_NIL")
			else
				buttonInfo.text = TEXT("SYS_CLASSNAME_MAGE").."/"..TEXT("SYS_CLASSNAME_"..v)
			end
			buttonInfo.value = v
			buttonInfo.func = SwapClassFrame_Dropdown5_Click
			UIDropDownMenu_AddButton(buttonInfo, 1)
		end
	end
end
function SwapClassFrame_Dropdown5_Click(button)
	UIDropDownMenu_SetSelectedValue(SwapClassFrame_Dropdown5, button.value)
	EXCHANGECLASS_MAINCLASS = 5
	if button.value == 0 then
		EXCHANGECLASS_SUBCLASS = 0
	elseif button.value == "WARRIOR" then
		EXCHANGECLASS_SUBCLASS = 2
	elseif button.value == "RANGER" then
		EXCHANGECLASS_SUBCLASS = 3
	elseif button.value == "THIEF" then
		EXCHANGECLASS_SUBCLASS = 4
	elseif button.value == "MAGE" then
		EXCHANGECLASS_SUBCLASS = 5	
	elseif button.value == "AUGUR" then
		EXCHANGECLASS_SUBCLASS = 6
	elseif button.value == "KNIGHT" then
		EXCHANGECLASS_SUBCLASS = 7
	elseif button.value == "WARDEN" then
		EXCHANGECLASS_SUBCLASS = 8
	elseif button.value == "DRUID" then
		EXCHANGECLASS_SUBCLASS = 9
	elseif button.value == "HARPSYN" then
		EXCHANGECLASS_SUBCLASS = 10
	elseif button.value == "PSYRON" then
		EXCHANGECLASS_SUBCLASS = 11
	end
end
-- Priest 6
function SwapClassFrame_Dropdown6_Show()
	CE.SwapClassClearText(6)
	for k,v in pairs(CE.ClassList) do
		if v ~= "AUGUR" then
			buttonInfo = {}
			if v == 0 then
				buttonInfo.text = TEXT("C_TITLE_NIL")
			else
				buttonInfo.text = TEXT("SYS_CLASSNAME_AUGUR").."/"..TEXT("SYS_CLASSNAME_"..v)
			end
			buttonInfo.value = v
			buttonInfo.func = SwapClassFrame_Dropdown6_Click
			UIDropDownMenu_AddButton(buttonInfo, 1)
		end
	end
end
function SwapClassFrame_Dropdown6_Click(button)
	UIDropDownMenu_SetSelectedValue(SwapClassFrame_Dropdown6, button.value)
	EXCHANGECLASS_MAINCLASS = 6
	if button.value == 0 then
		EXCHANGECLASS_SUBCLASS = 0
	elseif button.value == "WARRIOR" then
		EXCHANGECLASS_SUBCLASS = 2
	elseif button.value == "RANGER" then
		EXCHANGECLASS_SUBCLASS = 3
	elseif button.value == "THIEF" then
		EXCHANGECLASS_SUBCLASS = 4
	elseif button.value == "MAGE" then
		EXCHANGECLASS_SUBCLASS = 5	
	elseif button.value == "AUGUR" then
		EXCHANGECLASS_SUBCLASS = 6
	elseif button.value == "KNIGHT" then
		EXCHANGECLASS_SUBCLASS = 7
	elseif button.value == "WARDEN" then
		EXCHANGECLASS_SUBCLASS = 8
	elseif button.value == "DRUID" then
		EXCHANGECLASS_SUBCLASS = 9
	elseif button.value == "HARPSYN" then
		EXCHANGECLASS_SUBCLASS = 10
	elseif button.value == "PSYRON" then
		EXCHANGECLASS_SUBCLASS = 11
	end
end
-- Knight 7
function SwapClassFrame_Dropdown1_Show()
	CE.SwapClassClearText(1)
	for k,v in pairs(CE.ClassList) do
		if v ~= "KNIGHT" then
			buttonInfo = {}
			if v == 0 then
				buttonInfo.text = TEXT("C_TITLE_NIL")
			else
				buttonInfo.text = TEXT("SYS_CLASSNAME_KNIGHT").."/"..TEXT("SYS_CLASSNAME_"..v)
			end
			buttonInfo.value = v
			buttonInfo.func = SwapClassFrame_Dropdown1_Click;
			UIDropDownMenu_AddButton(buttonInfo, 1)
		end
	end
end
function SwapClassFrame_Dropdown1_Click(button)
	UIDropDownMenu_SetSelectedValue(SwapClassFrame_Dropdown1, button.value)
	EXCHANGECLASS_MAINCLASS = 7
	if button.value == 0 then
		EXCHANGECLASS_SUBCLASS = 0
	elseif button.value == "WARRIOR" then
		EXCHANGECLASS_SUBCLASS = 2
	elseif button.value == "RANGER" then
		EXCHANGECLASS_SUBCLASS = 3
	elseif button.value == "THIEF" then
		EXCHANGECLASS_SUBCLASS = 4
	elseif button.value == "MAGE" then
		EXCHANGECLASS_SUBCLASS = 5	
	elseif button.value == "AUGUR" then
		EXCHANGECLASS_SUBCLASS = 6
	elseif button.value == "KNIGHT" then
		EXCHANGECLASS_SUBCLASS = 7
	elseif button.value == "WARDEN" then
		EXCHANGECLASS_SUBCLASS = 8
	elseif button.value == "DRUID" then
		EXCHANGECLASS_SUBCLASS = 9
	elseif button.value == "HARPSYN" then
		EXCHANGECLASS_SUBCLASS = 10
	elseif button.value == "PSYRON" then
		EXCHANGECLASS_SUBCLASS = 11
	end
end
-- Warden 8
function SwapClassFrame_Dropdown7_Show()
	CE.SwapClassClearText(7)
	for k,v in pairs(CE.ClassList) do
		if v ~= "WARDEN" then
			buttonInfo = {}
			if v == 0 then
				buttonInfo.text = TEXT("C_TITLE_NIL")
			else
				buttonInfo.text = TEXT("SYS_CLASSNAME_WARDEN").."/"..TEXT("SYS_CLASSNAME_"..v)
			end
			buttonInfo.value = v
			buttonInfo.func = SwapClassFrame_Dropdown7_Click
			UIDropDownMenu_AddButton(buttonInfo, 1)
		end
	end
end
function SwapClassFrame_Dropdown7_Click(button)
	UIDropDownMenu_SetSelectedValue(SwapClassFrame_Dropdown7, button.value)
	EXCHANGECLASS_MAINCLASS = 8
	if button.value == 0 then
		EXCHANGECLASS_SUBCLASS = 0
	elseif button.value == "WARRIOR" then
		EXCHANGECLASS_SUBCLASS = 2
	elseif button.value == "RANGER" then
		EXCHANGECLASS_SUBCLASS = 3
	elseif button.value == "THIEF" then
		EXCHANGECLASS_SUBCLASS = 4
	elseif button.value == "MAGE" then
		EXCHANGECLASS_SUBCLASS = 5	
	elseif button.value == "AUGUR" then
		EXCHANGECLASS_SUBCLASS = 6
	elseif button.value == "KNIGHT" then
		EXCHANGECLASS_SUBCLASS = 7
	elseif button.value == "WARDEN" then
		EXCHANGECLASS_SUBCLASS = 8
	elseif button.value == "DRUID" then
		EXCHANGECLASS_SUBCLASS = 9
	elseif button.value == "HARPSYN" then
		EXCHANGECLASS_SUBCLASS = 10
	elseif button.value == "PSYRON" then
		EXCHANGECLASS_SUBCLASS = 11
	end
end
-- Druid 9
function SwapClassFrame_Dropdown8_Show()
	CE.SwapClassClearText(8)
	for k,v in pairs(CE.ClassList) do
		if v ~= "DRUID" then
			buttonInfo = {}
			if v == 0 then
				buttonInfo.text = TEXT("C_TITLE_NIL")
			else
				buttonInfo.text = TEXT("SYS_CLASSNAME_DRUID").."/"..TEXT("SYS_CLASSNAME_"..v)
			end
			buttonInfo.value = v
			buttonInfo.func = SwapClassFrame_Dropdown8_Click
			UIDropDownMenu_AddButton(buttonInfo, 1)
		end
	end
end
function SwapClassFrame_Dropdown8_Click(button)
	UIDropDownMenu_SetSelectedValue(SwapClassFrame_Dropdown8, button.value)
	EXCHANGECLASS_MAINCLASS = 9
	if button.value == 0 then
		EXCHANGECLASS_SUBCLASS = 0
	elseif button.value == "WARRIOR" then
		EXCHANGECLASS_SUBCLASS = 2
	elseif button.value == "RANGER" then
		EXCHANGECLASS_SUBCLASS = 3
	elseif button.value == "THIEF" then
		EXCHANGECLASS_SUBCLASS = 4
	elseif button.value == "MAGE" then
		EXCHANGECLASS_SUBCLASS = 5	
	elseif button.value == "AUGUR" then
		EXCHANGECLASS_SUBCLASS = 6
	elseif button.value == "KNIGHT" then
		EXCHANGECLASS_SUBCLASS = 7
	elseif button.value == "WARDEN" then
		EXCHANGECLASS_SUBCLASS = 8
	elseif button.value == "DRUID" then
		EXCHANGECLASS_SUBCLASS = 9
	elseif button.value == "HARPSYN" then
		EXCHANGECLASS_SUBCLASS = 10
	elseif button.value == "PSYRON" then
		EXCHANGECLASS_SUBCLASS = 11
	end
end
-- Warlock 10
function SwapClassFrame_Dropdown9_Show()
	CE.SwapClassClearText(9)
	for k,v in pairs(CE.ClassList) do
		if v ~= "HARPSYN" then
			buttonInfo = {}
			if v == 0 then
				buttonInfo.text = TEXT("C_TITLE_NIL")
			else
				buttonInfo.text = TEXT("SYS_CLASSNAME_HARPSYN").."/"..TEXT("SYS_CLASSNAME_"..v)
			end
			buttonInfo.value = v
			buttonInfo.func = SwapClassFrame_Dropdown9_Click
			UIDropDownMenu_AddButton(buttonInfo, 1)
		end
	end
end
function SwapClassFrame_Dropdown9_Click(button)
	UIDropDownMenu_SetSelectedValue(SwapClassFrame_Dropdown9, button.value)
	EXCHANGECLASS_MAINCLASS = 10
	if button.value == 0 then
		EXCHANGECLASS_SUBCLASS = 0
	elseif button.value == "WARRIOR" then
		EXCHANGECLASS_SUBCLASS = 2
	elseif button.value == "RANGER" then
		EXCHANGECLASS_SUBCLASS = 3
	elseif button.value == "THIEF" then
		EXCHANGECLASS_SUBCLASS = 4
	elseif button.value == "MAGE" then
		EXCHANGECLASS_SUBCLASS = 5	
	elseif button.value == "AUGUR" then
		EXCHANGECLASS_SUBCLASS = 6
	elseif button.value == "KNIGHT" then
		EXCHANGECLASS_SUBCLASS = 7
	elseif button.value == "WARDEN" then
		EXCHANGECLASS_SUBCLASS = 8
	elseif button.value == "DRUID" then
		EXCHANGECLASS_SUBCLASS = 9
	elseif button.value == "HARPSYN" then
		EXCHANGECLASS_SUBCLASS = 10
	elseif button.value == "PSYRON" then
		EXCHANGECLASS_SUBCLASS = 11
	end
end
-- Champion 11
function SwapClassFrame_Dropdown10_Show()
	CE.SwapClassClearText(10)
	for k,v in pairs(CE.ClassList) do
		if v ~= "PSYRON" then
			buttonInfo = {}
			if v == 0 then
				buttonInfo.text = TEXT("C_TITLE_NIL")
			else
				buttonInfo.text = TEXT("SYS_CLASSNAME_PSYRON").."/"..TEXT("SYS_CLASSNAME_"..v)
			end
			buttonInfo.value = v
			buttonInfo.func = SwapClassFrame_Dropdown10_Click
			UIDropDownMenu_AddButton(buttonInfo, 1)
		end
	end
end
function SwapClassFrame_Dropdown10_Click(button)
	UIDropDownMenu_SetSelectedValue(SwapClassFrame_Dropdown10, button.value)
	EXCHANGECLASS_MAINCLASS = 11
	if button.value == 0 then
		EXCHANGECLASS_SUBCLASS = 0
	elseif button.value == "WARRIOR" then
		EXCHANGECLASS_SUBCLASS = 2
	elseif button.value == "RANGER" then
		EXCHANGECLASS_SUBCLASS = 3
	elseif button.value == "THIEF" then
		EXCHANGECLASS_SUBCLASS = 4
	elseif button.value == "MAGE" then
		EXCHANGECLASS_SUBCLASS = 5	
	elseif button.value == "AUGUR" then
		EXCHANGECLASS_SUBCLASS = 6
	elseif button.value == "KNIGHT" then
		EXCHANGECLASS_SUBCLASS = 7
	elseif button.value == "WARDEN" then
		EXCHANGECLASS_SUBCLASS = 8
	elseif button.value == "DRUID" then
		EXCHANGECLASS_SUBCLASS = 9
	elseif button.value == "HARPSYN" then
		EXCHANGECLASS_SUBCLASS = 10
	elseif button.value == "PSYRON" then
		EXCHANGECLASS_SUBCLASS = 11
	end
end
